package com.nuoniu.sibanyun.mapper.production;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.production.ErpBomDetail;
import com.nuoniu.sibanyun.entity.vo.ErpBomDetailVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * bom明细表 Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2021-01-08
 */
public interface VBomDetailMapper extends BaseMapper<ErpBomDetail> {

    /**
     * 获取子级
     * @author 小啊刚
     * @date 2021-03-15
     */
    @Select("select * from mab_bom_detail where order_id=#{bomId}")
    List<ErpBomDetail> getByBomId(Long bomId);


    @Select("SELECT m.version_code AS parentBomVersion,d.* from mab_bom_detail d INNER JOIN mab_bom m ON m.id = d.order_id AND m.company_id = #{companyId}  AND d.order_id = #{parentBomId}")
    List<ErpBomDetailVo> listErpBomDetailVo(Long parentBomId,Integer companyId);
}
